package com.ss.android.article.browser.constant;

import android.support.annotation.Nullable;
import android.util.Log;

import com.a.a.t;
import com.ss.android.article.browser.database.a.a;

import java.io.Closeable;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

import inline.FileUtils;

final class i extends t {
    private final g a;

    i(g arg1) {
        this.a = arg1;
    }

    public final void a(@Nullable Object arg7) {
        Closeable v1_2;
        FileWriter v1_1 = null;
        String v2 = this.a.c.getDownloadLocation();
        StringBuilder v3 = new StringBuilder("<!DOCTYPE html><html xmlns=http://www.w3.org/1999/xhtml>\n" +
                "<head>\n<meta content=en-us http-equiv=Content-Language />\n" +
                "<meta content=\'text/html; charset=utf-8\' http-equiv=Content-Type />\n" +
                "<meta name=viewport content=\'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\'>\n" +
                "<title>" + this.a.a + "</title></head><style>body,html {margin: 0px; padding: 0px;}.box { vertical-align:middle;position:relative; display: block; margin: 0px;padding-left:14px;padding-right:14px;padding-top:9px;padding-bottom:9px; background-color:#fff;border-bottom: 1px solid #d2d2d2;font-family: Arial;color: #444;font-size: 12px;}.box a { width: 100%; height: 100%; position: absolute; left: 0; top: 0;}.black {color: black;font-size: 15px;font-family: Arial; white-space: nowrap; overflow: hidden;margin:auto; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis;}.font {color: gray;font-size: 10px;font-family: Arial; white-space: nowrap; overflow: hidden;margin:auto; text-overflow: ellipsis; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis;}</style><body><div id=\"content\">");
        int v4 = ((List)arg7).size();
        int v1;
        for(v1 = 0; v1 < v4; ++v1) {
            Object v0 = ((List)arg7).get(v1);
            v3.append("<div class=box><a href=\'");
            v3.append("file://");
            v3.append(v2);
            v3.append("/");
            v3.append(((a)v0).b);
            v3.append("\'></a><p class=\'black\'>");
            v3.append(((a)v0).b);
            if(!((a)v0).c.isEmpty()) {
                v3.append(" [");
                v3.append(((a)v0).c);
                v3.append("]");
            }

            v3.append("</p><p class=\'font\'>");
            v3.append(((a)v0).a);
            v3.append("</p></div>");
        }

        v3.append("</div></body></html>");
        Closeable v2_1 = null;
        try {
            v1_1 = new FileWriter(g.a(this.a.b), false);
            v1_1.write(v3.toString());
        } catch(IOException v0_2) {
                Log.e("DownloadsPage", "Unable to write download page to disk", ((Throwable)v0_2));
        }finally {
           FileUtils.a(v1_1);
        }
    }
}

